package pl.edu.pk.mech.kkbus.model;

import static pl.edu.pk.mech.kkbus.staticstrings.DefectProperty.DEFECT_COSTS;
import static pl.edu.pk.mech.kkbus.staticstrings.DefectProperty.DEFECT_DATE;
import static pl.edu.pk.mech.kkbus.staticstrings.DefectProperty.DEFECT_DESC;
import static pl.edu.pk.mech.kkbus.staticstrings.DefectProperty.DEFECT_ID_BUS;

import java.io.Serializable;
import java.util.Date;

import com.google.appengine.api.datastore.Entity;

public class Defect extends Pojo implements Serializable{

	private static final long serialVersionUID = -809706643424121990L;
	private String description;
    private Date date;
    private Double costs;
    private String idBus;
    
    public Defect(){}

    public Defect(long id, String description, Date date, Double costs, String idBus) {
        super(id);
        this.description = description;
        this.date = date;
        this.costs = costs;
        this.idBus = idBus;
    }
    
    public Defect(Entity entity){
    	this.id = entity.getKey().getId();
    	this.description = (String) entity.getProperty(DEFECT_DESC);
    	this.date = (Date) entity.getProperty(DEFECT_DATE);
    	this.costs = Double.valueOf(entity.getProperty(DEFECT_COSTS).toString());
    	this.idBus = (String) entity.getProperty(DEFECT_ID_BUS).toString();
    }
    
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	public Double getCosts() {
		return costs;
	}
	public void setCosts(Double costs) {
		this.costs = costs;
	}

	public String getIdBus() {
		return idBus;
	}

	public void setIdBus(String idBus) {
		this.idBus = idBus;
	}    
}
